using System;
using System.Drawing;
using System.IO;
using View.Common;
using View.Replay.Application;
namespace View.Replay
{
	public class ReplaySettingParam
	{
		private ParameterCollection persist;
		public int ReplayTimeLen
		{
			get;
			set;
		}
		public Color UnBufferedDataColor
		{
			get;
			set;
		}
		public Color BufferedDataColor
		{
			get;
			set;
		}
		public Color SliderColor
		{
			get;
			set;
		}
		public bool IsSkipEmptyDataSegment
		{
			get;
			set;
		}
		public ReplaySettingParam()
		{
            string text = UtilityFunc.GetApplicationPath() + "state\\";
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			this.persist = new ParameterCollection(text + "replaysetting", "Default", true);
			this.ReplayTimeLen = this.persist.GetIntValue("回放时间长度", 30);
			this.UnBufferedDataColor = Color.FromArgb(this.persist.GetIntValue("未缓冲数据颜色", Color.Olive.ToArgb()));
			this.BufferedDataColor = Color.FromArgb(this.persist.GetIntValue("已缓冲数据颜色", Color.DarkGreen.ToArgb()));
			this.SliderColor = Color.FromArgb(this.persist.GetIntValue("滑块颜色", Color.Orange.ToArgb()));
			this.IsSkipEmptyDataSegment = this.persist.GetBoolValue("跳过无效数据段", true);
		}
		public void Save()
		{
			this.persist.Add("回放时间长度", this.ReplayTimeLen);
			this.persist.Add("未缓冲数据颜色", this.UnBufferedDataColor.ToArgb());
			this.persist.Add("已缓冲数据颜色", this.BufferedDataColor.ToArgb());
			this.persist.Add("滑块颜色", this.SliderColor.ToArgb());
			this.persist.Add("跳过无效数据段", this.IsSkipEmptyDataSegment);
			this.persist.SaveDirect();
		}
	}
}
